home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / feverfrenzy-demo.swf / scripts / DefineSprite_216 / frame_1 / DoAction.as
Text File  |  2007-09-28  |  4KB  |  210 lines

  1. function reset()
  2. {
  3.    setEstado(0);
  4.    mCount = 1;
  5.    mCount_mc._visible = false;
  6.    mHealth_mc.setLevel(0);
  7.    mCor = 0;
  8.    mPaciente = null;
  9.    greenLightOff();
  10.    redLightOff();
  11. }
  12. function setNumber(n)
  13. {
  14.    reset();
  15.    mID = n;
  16.    mNumber_mc.gotoAndStop(n);
  17. }
  18. function isReady()
  19. {
  20.    return mEstado == 0;
  21. }
  22. function isOcupada()
  23. {
  24.    return mEstado == 1;
  25. }
  26. function getColor()
  27. {
  28.    return mCor;
  29. }
  30. function setColor(cor)
  31. {
  32.    mCor = cor;
  33.    setEstado(mEstado);
  34. }
  35. function getEstado()
  36. {
  37.    return mEstado;
  38. }
  39. function getPaciente()
  40. {
  41.    return mPaciente;
  42. }
  43. function aceitaPaciente(paciente)
  44. {
  45.    var _loc3_ = {x:this._xmouse,y:this._ymouse};
  46.    this.localToGlobal(_loc3_);
  47.    if(!mMouseMask_mc.hitTest(_loc3_.x,_loc3_.y,false))
  48.    {
  49.       return false;
  50.    }
  51.    if(mEstado == 0 && paciente != null)
  52.    {
  53.       mPaciente = paciente;
  54.       if(mPaciente.getColor() == mCor)
  55.       {
  56.          mCount++;
  57.          mCount_mc.setColor(mCor);
  58.          mCount_mc.setValue(mCount);
  59.          mCount_mc._visible = true;
  60.          colorbonus();
  61.       }
  62.       else
  63.       {
  64.          mCount = 1;
  65.          mCount_mc._visible = false;
  66.       }
  67.       mCor = mPaciente.getColor();
  68.       var _loc4_ = {x:this._x + 2,y:this._y - 18};
  69.       mPaciente._x = _loc4_.x;
  70.       mPaciente._y = _loc4_.y;
  71.       mPaciente.naCama(mID);
  72.       setEstado(1);
  73.       _parent.verifyFullBeds();
  74.       return true;
  75.    }
  76.    return false;
  77. }
  78. function colorbonus()
  79. {
  80.    valor = mPaciente.getColorBonus() * mCount;
  81.    mFly_mc.showMessage("colorbonus",valor);
  82.    _parent.addPoints(valor);
  83. }
  84. function liberaPaciente()
  85. {
  86.    setEstado(2);
  87.    mpaciente = null;
  88.    greenLightOff();
  89.    redLightOff();
  90.    mHealth_mc.setLevel(0);
  91. }
  92. function setEstado(novo)
  93. {
  94.    mEstado = novo;
  95.    mBedLight_mc.gotoAndStop("empty");
  96.    if(novo == 1)
  97.    {
  98.       var _loc1_ = getFramePrefix();
  99.       _loc1_ += "2";
  100.       gotoAndStop(_loc1_);
  101.       updateHealth(mPaciente.getHealth());
  102.    }
  103.    else if(novo == 2)
  104.    {
  105.       mPaciente = null;
  106.       mHealth_mc.setLevel(0);
  107.       _loc1_ = getFramePrefix();
  108.       _loc1_ += "3";
  109.       gotoAndStop(_loc1_);
  110.    }
  111.    else if(novo == 0)
  112.    {
  113.       _loc1_ = getFramePrefix();
  114.       _loc1_ += "1";
  115.       mHealth_mc.setLevel(0);
  116.       gotoAndStop(_loc1_);
  117.    }
  118. }
  119. function getFramePrefix()
  120. {
  121.    var _loc1_ = "g";
  122.    switch(mCor)
  123.    {
  124.       case 0:
  125.          _loc1_ = "g";
  126.          break;
  127.       case 1:
  128.          _loc1_ = "r";
  129.          break;
  130.       case 2:
  131.          _loc1_ = "y";
  132.          break;
  133.       case 3:
  134.          _loc1_ = "b";
  135.    }
  136.    return _loc1_;
  137. }
  138. function redLightOn()
  139. {
  140.    mBedLight_mc.gotoAndStop("red");
  141. }
  142. function redLightOff()
  143. {
  144.    mBedLight_mc.gotoAndStop("empty");
  145. }
  146. function greenLightOn()
  147. {
  148.    mBedLight_mc.gotoAndStop("green");
  149. }
  150. function greenLightOff()
  151. {
  152.    mBedLight_mc.gotoAndStop("empty");
  153. }
  154. function updateHealth(h)
  155. {
  156.    mHealth_mc.setLevel(Math.round(h * 11));
  157. }
  158. function pausa()
  159. {
  160.    mbPaused = true;
  161. }
  162. function continua(elapsed)
  163. {
  164.    mbPaused = false;
  165. }
  166. stop();
  167. var mEstado;
  168. var mCor;
  169. var mPaciente;
  170. var mCount;
  171. var mID;
  172. mMouseMask_mc._visible = false;
  173. var lastMouseIn = false;
  174. this.onMouseMove = function()
  175. {
  176.    if(!this._visible || mbPaused)
  177.    {
  178.       return undefined;
  179.    }
  180.    var _loc3_ = {x:this._xmouse,y:this._ymouse};
  181.    this.localToGlobal(_loc3_);
  182.    if(mMouseMask_mc.hitTest(_loc3_.x,_loc3_.y,false))
  183.    {
  184.       if(!lastMouseIn)
  185.       {
  186.          lastMouseIn = true;
  187.          _root.cursor_mc.setOver2(this);
  188.       }
  189.    }
  190.    else if(lastMouseIn)
  191.    {
  192.       lastMouseIn = false;
  193.       _root.cursor_mc.setNotOver2(this);
  194.    }
  195. };
  196. this.onMouseDown = function()
  197. {
  198.    if(!this._visible || mbPaused)
  199.    {
  200.       return undefined;
  201.    }
  202.    var _loc3_ = {x:this._xmouse,y:this._ymouse};
  203.    this.localToGlobal(_loc3_);
  204.    if(mMouseMask_mc.hitTest(_loc3_.x,_loc3_.y,false))
  205.    {
  206.       _parent.moveToBed(mID);
  207.    }
  208. };
  209. var mbPaused = false;
  210.